<template>
  <div>
   <input placeholder="Header请输入任务" 
   v-model="value"
   @keydown.enter="enter"
   >
  </div>
</template>
<script>
import {defineComponent,ref} from 'vue'
export default defineComponent({
  name:'navHeader',
  //子传父
  setup(props,ctx){
    let value=ref('');
    let enter=()=>{
      ctx.emit('add',value.value)
      //清空输入框
      value.value=''
      // console.log(value.value);
    }
    return{
      value,
      enter
    }
  }
})
</script>
<style scoped lang='scss'>
input{
  margin-top: 20px;
  margin-bottom: 20px;
  
}
</style>
